#pragma once

#include <memory>

#include <btBulletDynamicsCommon.h>
#include "physics_IJoint.h"

class BulletRigid;
class IPhysicsRigid;
struct JointParam;

class BulletJoint : public IPhysicsJoint {
public:
	BulletJoint(std::unique_ptr<btDiscreteDynamicsWorld> &rupWorld,
		JointParam &param, IPhysicsRigid &rigid_1, IPhysicsRigid &rigid_2);
	~BulletJoint();
	void AttachToWorld() override;
	void DetachFromWorld() override;
private:
	bool m_attached = false;
	std::unique_ptr<btGeneric6DofSpringConstraint> m_upConstraint;
	std::unique_ptr<btDiscreteDynamicsWorld> &m_rupWorld;
};
